<!DOCTYPE html>
<html>
<head> 
<meta charset="utf-8"> 
<title>菜鸟教程(runoob.com)</title> 
</head>
<body>

<p>创建和使用对象方法。</p>
<p>对象方法作为一个函数定义存储在对象属性中。</p>
<p id="demo"></p>
<script>
var person = {
    firstName: "John",
    lastName : "Doe",
    id : 5566,
    fullname : function (){
        return "name : "+this.firstName +"·"+ this.lastName + "<br>id : " + this.id;
    }
};
document.getElementById("demo").innerHTML = person.fullname();
// methodName : function() {
//     // 代码 
// }
</script>
	
</body>
</html>